//
//  CoreAnimationTableVC.m
//  HDTransitonDemo
//
//  Created by mac on 2017/6/14.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "CoreAnimationTableVC.h"

@interface CoreAnimationTableVC (){
    NSArray *_names;
    NSArray *_classNames;
}

@end
static NSString *reuseIdentifier = @"coreAnimationCell";
@implementation CoreAnimationTableVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"动画的类型";
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:reuseIdentifier];
    _names = @[@"CABasicAnimation", @"CAKeyframeAnimation", @"CAAnimationGroup"];
    _classNames = @[@"CABasicAnimationVC", @"KeyFrameAnimationVC", @"AnimationGroupVC"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _names.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier forIndexPath:indexPath];
    
    cell.textLabel.text = _names[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UIViewController *vc = [[NSClassFromString(_classNames[indexPath.row]) alloc] init];
    vc.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController pushViewController:vc animated:YES];
}


@end
